# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/13 19:09
# @Author   : Robot-Zsj
"""
description:

i:
2 2
1 1
2 2

o:
1 2

"""
import sys

while True:
    try:
        l1, l2 = map(int, input().split())
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))

        sumA = sum(A)

        sumB = 0
        setB = set()

        for b in B:
            sumB += b
            setB.add(b)

        half_diff = (sumA - sumB) // 2

        minA = sys.maxsize
        ans = ""

        for a in A:
            b = a - half_diff

            if b in setB:
                if a < minA:
                    minA = a
                    ans = f"{a} {b}"
        print(ans)
    except:
        break
